//===============================================================================
// @ Obstacle.cpp
// ------------------------------------------------------------------------------
// Obstacle object
//
// Copyright (C) 2008-2015 by James M. Van Verth and Lars M. Bishop.
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This is an obstacle for the player to hit.  It is derived from SimObject, 
// so all the integration and collision detection code can be found there.  
//
//===============================================================================

//-------------------------------------------------------------------------------
//-- Dependencies ---------------------------------------------------------------
//-------------------------------------------------------------------------------

#include <IvEventHandler.h>

#include "Obstacle.h"
#include "Game.h"

//-------------------------------------------------------------------------------
//-- Static Members -------------------------------------------------------------
//-------------------------------------------------------------------------------

//-------------------------------------------------------------------------------
//-- Methods --------------------------------------------------------------------
//-------------------------------------------------------------------------------

//-------------------------------------------------------------------------------
// @ Obstacle::Obstacle()
//-------------------------------------------------------------------------------
// Constructor
//-------------------------------------------------------------------------------
Obstacle::Obstacle() : SimObject()
{
    SetTranslate( IvVector3( 0.0f, 3.0f, 0.0f ) );
    
    mElasticity = 0.65f;
    SetMass(20.0f);

}   // End of Obstacle::Obstacle()


//-------------------------------------------------------------------------------
// @ Obstacle::~Obstacle()
//-------------------------------------------------------------------------------
// Destructor
//-------------------------------------------------------------------------------
Obstacle::~Obstacle()
{
}   // End of Obstacle::~Obstacle()


//-------------------------------------------------------------------------------
// @ Obstacle::Update()
//-------------------------------------------------------------------------------
// Main update loop
//-------------------------------------------------------------------------------
void
Obstacle::Update( float dt )
{   
    if (IvGame::mGame->mEventHandler->IsKeyDown(' '))
    {
        SetTranslate( IvVector3( 0.0f, 3.0f, 0.0f ) );
        mRotate.Identity();
        mVelocity.Zero();
        mAngularMomentum.Zero();
        mAngularVelocity.Zero();
    }

    SimObject::Update( dt );
}
